package com.lupan.guice.bindings.instanceBinding;

import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.name.Names;
import com.lupan.guice.bindings.BillingService;
import com.lupan.guice.bindings.BillingServiceModule;
import com.lupan.guice.bindings.DatabaseTransactionLog;
import com.lupan.guice.bindings.MysqlDatabaseTransactionLog;

/**
 * 说明:
 *
 * @author lupan
 * @version 2016/9/27 0027 下午 9:56
 */
public class Main {
    public static void main(String[] args) {
        Injector injector = Guice.createInjector(new AbstractModule() {
            @Override
            protected void configure() {
                bind(String.class).annotatedWith(Names.named("url")).toInstance("www.baidu.com");
            }
        },new BillingServiceModule());

        BillingService3 billingService = injector.getInstance(BillingService3.class);

        System.out.println(billingService.getUrl());
    }
}
